using System.Collections.ObjectModel;
using HMCollada.Core;
using System.Xml;
using HMCollada.FX;

namespace HMCollada.FX {
    internal struct HMColladaBindMaterial {
        internal Collection<HMColladaParam> param;
        internal HMColladaTechniqueCommon technique_common;
        internal Collection<HMColladaTechnique> technique;
    }
}

namespace HMCollada {
    internal partial class HMColladaLoader {
        private static HMColladaBindMaterial LoadBindMaterial() {
            HMColladaBindMaterial newBindMaterial = new HMColladaBindMaterial();

            newBindMaterial.technique = new Collection<HMColladaTechnique>();

            if (!colladaReader.IsEmptyElement) colladaReader.Read();
            do {
                if (colladaReader.NodeType != XmlNodeType.EndElement) {
                    switch (colladaReader.Name) {
                        case "param": newBindMaterial.param.Add(LoadParam()); break;
                        case "technique_common": newBindMaterial.technique_common = LoadTechniqueCommon(); break;
                        case "technique": newBindMaterial.technique.Add(LoadTechnique()); break;
                    }
                }

                if (!colladaReader.IsEmptyElement) colladaReader.Read();
            } while (colladaReader.Name != "bind_material");

            if (colladaReader.IsEmptyElement) colladaReader.Read();
            return newBindMaterial;
        }
    }
}